// 加载公共组件
async function loadComponents() {
  // 加载侧边栏
  const sidebarContainer = document.querySelector('#sidebar-container');
  if (sidebarContainer) {
    const response = await fetch('/components/sidebar.html');
    const html = await response.text();
    sidebarContainer.innerHTML = html;
    
    // 设置当前页面菜单激活状态
    const currentPage = window.location.pathname.split('/').pop() || 'index.html';
    const menuMap = {
      'index.html': 'menu-index',
      'CM-01.html': 'menu-customer',
      'employee-list.html': 'menu-employee',
      'contract-management.html': 'menu-contract',
      'salary-management.html': 'menu-salary',
      'contract-template.html': 'menu-template'
    };
    
    const menuId = menuMap[currentPage];
    if (menuId) {
      const menuItem = document.getElementById(menuId);
      if (menuItem) {
        menuItem.classList.add('active');
      }
    }
  }
} 